package com.xqboss.apps.dto.user;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.xqboss.apps.enums.nft.NftTypeEnum;
import com.xqboss.apps.enums.nft.UserNftStatusEnum;
import com.xqboss.apps.enums.user.UserNftSourceTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Objects;

/**
 * <p>
 *     用户藏品列表请求
 * </p>
 * @author Trent
 * @date 2023/8/30
 */
@Data
@ApiModel
public class AppUserNftListDto {

    @ApiModelProperty("用户ID（APP不用传）")
    private Long userId;

    @ApiModelProperty("藏品ID")
    private Long nftId;

    @ApiModelProperty("藏品类型")
    private NftTypeEnum nftType;

    @ApiModelProperty("藏品状态")
    private UserNftStatusEnum nftStatus;

    @ApiModelProperty("藏品来源")
    private UserNftSourceTypeEnum source;

    @ApiModelProperty("开始时间")
    private LocalDateTime createTimeStart;

    @ApiModelProperty("结束时间")
    private LocalDateTime createTimeEnd;

    @ApiModelProperty("搜索")
    private String searchValue;

    @ApiModelProperty("是否按照装备优先级排序, 默认为：否")
    private Boolean sortByEquip;


    @ApiModelProperty(hidden = true)
    @JsonIgnore
    private Long firstUserNftId;

    @ApiModelProperty("合成材料ID")
    private Long synthesisConsumeId;


    @Deprecated
    @ApiModelProperty("等级阈值筛选 - 返回大于等于该等级的")
    private Integer levelThreshold;

    @Deprecated
    @ApiModelProperty("破损值阈值筛选 - 返回大于等于该破损值比例的")
    private BigDecimal breakageThreshold;

    @Deprecated
    @ApiModelProperty("耐久值阈值筛选 - 返回大于等于该耐久值比例的")
    private BigDecimal durableThreshold;

    @ApiModelProperty(value = "最小耐久值")
    private BigDecimal minDurable;

    @ApiModelProperty(value = "最大耐久值")
    private BigDecimal maxDurable;

    @ApiModelProperty(value = "最小破损值")
    private BigDecimal minBreakage;

    @ApiModelProperty(value = "最大破损值")
    private BigDecimal maxBreakage;

    @ApiModelProperty(value = "最小等级值")
    private Integer minLevel;

    @ApiModelProperty(value = "最大等级值")
    private Integer maxLevel;



    @ApiModelProperty("新装备筛选,选中则true,不选中则不传")
    private Boolean newEquipment;

    @ApiModelProperty("新装备筛选,选中则true,不选中则不传")
    private Boolean oldEquipment;

    @ApiModelProperty("装备筛选最小等级")
    private Integer minLeave;

    @ApiModelProperty("装备筛选最大等级")
    private Integer maxLeave;


    public LocalDateTime getCreateTimeEnd() {
        if(Objects.nonNull(createTimeEnd)){
            return createTimeEnd.with(LocalTime.MAX);
        }
        return createTimeEnd;
    }
}
